﻿//======================================================================
//
//        Copyright (C) 2015   
//        All rights reserved
//
//        filename : PutOutSendCard
//        description : 半成品/成品卡发放

//        created by XXX at  20150821
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Data;

namespace CardLogistics.Web.MainPage.PutOutCard.PutOutSendCard
{
    public partial class Detail : BasePage
    {
        private static readonly CardLogistics.DAL.PutOutCard.PutOutSendCardData DAL = new DAL.PutOutCard.PutOutSendCardData();
        private static readonly CardLogistics.DAL.PutOutCard.PutOutSendCard_DetailData DDAL = new CardLogistics.DAL.PutOutCard.PutOutSendCard_DetailData();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void InitControl()
        {
            string _key = Request.QueryString["id"];
            WebUserControl_AppInfo1.InfoID = _key;
            WebUserControl_AppInfo1.UserID = LoggedUser.ID;
            if (!string.IsNullOrEmpty(_key))
            {
                CardLogistics.Model.PutOutCard.PutOutSendCard pData = DAL.GetModel(_key);
                SetWebControls(this.Page, pData);
                if (pData!= null)
                {
                    //领用日期
                    if (pData.LEADINGDATE != null)
                    {
                        LEADINGDATE.Text = DateTime.Parse(pData.LEADINGDATE.ToString()).ToString("yyyy-MM-dd");
                    }
                }
                DataTable dt = DDAL.GetInfoBySendcardId(pData.ID);//查询卡片发放单明细信息
                rptDetailList.DataSource = dt;
                dt.DefaultView.Sort = "StartCardNo ASC,EndCardNo ASC";
                rptDetailList.DataBind();
            }
        }
    }
}